package com.leo.collisions;

import com.almasb.fxgl.entity.Entity;
import com.almasb.fxgl.physics.CollisionHandler;
import com.leo.common.Config;
import com.leo.common.GameType;

/**
 * 子弹和森林的碰撞检测
 */
public class BulletGreensHandler extends CollisionHandler {

    public BulletGreensHandler() {
        super(GameType.BULLET, GameType.GREENS);
    }

    @Override
    protected void onCollisionBegin(Entity a, Entity b) {
        int level = a.getInt("level");
        if (level >= Config.TANK_MAX_LEVEL) {
            b.removeFromWorld();
        }
    }
}
